package com.zeratul.cloud.demo1.controller;

import com.zeratul.cloud.demo1.entity.User;
import com.zeratul.common.core.result.R;
import com.zeratul.common.core.utils.I18nUtils;
import com.zeratul.web.validate.utils.ZtValidUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/i18n")
public class I18nTestController {

    @GetMapping("/test")
    public R<String> i18nTest() {
        return R.success(I18nUtils.getMessage("400"));
    }

    @GetMapping("/test2")
    public R<String> i18nTest2(User user) {
        ZtValidUtils.validate(user);
        return R.success(I18nUtils.getMessage("10001", "参数错误"));
    }
}
